//
// Created by iguilty on 2022-01-17.
//

#ifndef DESIGN_PATTERN_CPP_INTERPRET_H
#define DESIGN_PATTERN_CPP_INTERPRET_H

#include "Context.h"
#include <string>
using namespace std;

class AbstractExpression{
public:
    virtual ~AbstractExpression();
    virtual void Interpret(const Context& c);

protected:
    AbstractExpression();
};

class TerminalExpression:public AbstractExpression{
public:
    TerminalExpression(const string& statement);
    ~TerminalExpression();
    void Interpret(const Context& c);

private:
    string _statement;
};

class NonterminalExpression:public AbstractExpression{
public:
    NonterminalExpression(AbstractExpression* expression,int times);
    ~NonterminalExpression();
    void Interpret(const Context& c);

private:
    AbstractExpression* _expression;
    int _times;
};

#endif //DESIGN_PATTERN_CPP_INTERPRET_H
